package com.leapp.sk.ui.adapter

import android.content.Context
import android.view.View
import com.example.mvp.adapter.BaseLibAdapter
import com.example.mvp.binder.BaseDataBinder
import com.leapp.sk.R
import com.leapp.sk.bean.CompleteTaskEntity
import com.leapp.sk.binder.BaseBinder
import com.leapp.sk.viewdelegate.adapter.task.ImageTaskAdapterDelegate

/**
 *发送通知上传图片视图托管类
 * @author  chaohaipeng  on 2018/8/10.
 */
class SendNotifyUPImageAdapter (context: Context, mlist: MutableList<String>) : BaseLibAdapter<ImageTaskAdapterDelegate,String>(context, mlist){
    /**
     * 数据
     */
    val mList = mlist
    /**
     * 上下文
     */
    val mContext = context


    override fun bindEvenListener(viewDelegate: ImageTaskAdapterDelegate?, position: Int) {
        val get = mList.get(position)
        viewDelegate?.setOnClickListener(View.OnClickListener {
            if (mList.contains(get)){
                mList.remove(get)
            }
            notifyDataSetChanged()
        }, R.id.iv_ati_delete_btn)
    }

    override fun notifyView(viewDelegate: ImageTaskAdapterDelegate?, position: Int) {
        viewDelegate?.setData(mContext,mList.get(position),false)
    }

    override fun getDelegateClass(): Class<ImageTaskAdapterDelegate> {
        return ImageTaskAdapterDelegate::class.java
    }

    override fun getDataBinder(): BaseDataBinder<*, *> {
        return BaseBinder()
    }


}